#include "heartrate.h"
#include "OLED.H"
uint8_t isDetectHeartRate = 0;
extern viewCallback viewFunc;
uint8_t heartRate = 0;
void heartrate_view(void);
extern const uint8_t heartRateImage[][512];
/* ----------------------------------- 初始化 ---------------------------------- */
void heartrate_init(void)
{
    viewFunc = heartrate_view;
    setButtonFunc((ButtonCallback)nullFunc, (ButtonCallback)nullFunc, (ButtonCallback)nullFunc);
    heartRate = 0;
    isDetectHeartRate = 1;
}

/* ----------------------------------- 视图 ----------------------------------- */
void heartrate_view(void)
{
    static uint8_t z = 0;
    if(heartRate >= 100)
        OLED_ShowNum(10, 16, heartRate, 3, OLED_16X32);
    else
        OLED_ShowNum(26, 16, heartRate, 2, OLED_16X32);
    
    OLED_ShowImage(63,0,64,64,&heartRateImage[(z++)/5][0]);
    if(z == 30)
        z = 0;
}
/* ----------------------------------- 按键 ----------------------------------- */
